﻿Imports System.Drawing

Namespace Forms.Utilities
    Public Class RenderHelper

        Public Shared Function GetColor(ByVal color As Color, ByVal a As Integer, ByVal r As Integer, ByVal g As Integer, ByVal b As Integer) As Color
            Dim _A As Integer = color.A
            Dim _R As Integer = color.B
            Dim _G As Integer = color.G
            Dim _B As Integer = color.B

            If a + _A > 255 Then
                a = 255
            Else
                a = Math.Max(0, a + _A)
            End If

            If r + _R > 255 Then
                r = 255
            Else
                r = Math.Max(0, r + _R)
            End If

            If g + _G > 255 Then
                g = 255
            Else
                g = Math.Max(0, g + _G)
            End If

            If b + _B > 255 Then
                b = 255
            Else
                b = Math.Max(0, b + _B)
            End If

            Return color.FromArgb(a, r, g, b)
        End Function
    End Class
End Namespace

